/**
 * @file bsp_gensor.h
 * @brief 
 * @author  ()
 * @version 1.0
 * @date 2024-09-13
 * @ingroup bsp
 * @copyright Copyright (C) 2019 Queclink Wireless Solutions (ShenZhen) Co., Ltd. All Rights Reserved.
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2024-09-13 <td>1.0     <td>     <td>内容
 * </table>
 */
#ifndef __BSP_GSENSOR_H
#define __BSP_GSENSOR_H

#include <stdint.h>


#ifdef __cplusplus
extern "C" {
#endif


typedef union {
    int (*spi)(unsigned int addr, unsigned char addr_len, unsigned char *data, unsigned int len);   /* read/write to sensor, e.g. SPI */
    int (*i2c)(unsigned char dev, unsigned char addr, unsigned char *data, unsigned int len);       /* read/write to sensor by I2C */
} sensor_interface_t;

/* qltask_snsr_ops_t
 * 用于根据宏定义选择链接函数
 */
struct qltask_snsr_ops_t {
    sensor_interface_t  read_reg;
    sensor_interface_t  write_reg;
    int  (* turnover_param_config)(double angle, unsigned int duration, const void *accel);
    int  (* harsh_thold_set)(int type, int mode, const void *thold);
    int  (* freefall_thold_set)(float rest_acc, unsigned int duration);
    int  (* tow_param_set)(int mode, int engine_off, int fake_delay, int rpt_inr);
    int  (* eulerParamConfig)(void* ori, void* initAcc);
    int  (* eulerGet)(void* euler);
    void (* eulerRawUpdateHook)(void *acc, void *gyro);
    int (* ignition_param_set)(void *param);
    const struct qltask_calib_if *calib_if;
    const struct qltask_crash_if *crash_if;
    unsigned int (*motion_aid)(unsigned int status);
    struct snsr_aid_ops *aid_ops;
    struct snsr_int_ops *int_ops;
};

int32_t bsp_gsensor_init(void);


#ifdef __cplusplus
}
#endif


#endif